package br.com.felix.fwt.ui.css;

import java.io.Serializable;


/**
 * Utility class to define colors in CSS.
 */
public class Color implements Serializable{

	
	private static final long serialVersionUID = 7651394012144623805L;

	/** The color. */
	private String color;
	
	/**
	 * The red value of RGB color.
	 * */
	private int red;
	
	/**
	 * The green value of RGB color.
	 * */
	private int green;
	
	/**
	 * The blue value of RGB color.
	 * */
	private int blue;
	

	/**
	 * Instantiates a new color defined with RGB numbers.
	 * 
	 * @param red the red value (0 to 255). No validation is made.
	 * @param green the green (0 to 255). No validation is made.
	 * @param blue the blue value (0 to 255). No validation is made.
	 */
	public Color(int red, int green, int blue){
		color = "rgb("+red+","+green+","+blue+")";
		this.red = red;
		this.green = green;
		this.blue = blue;
	}
	
	/**
	 * Instantiates a new color a predefined color name.
	 * 
	 * @param c the desired color.
	 */
	public Color(Colors c){
		this.color = c.toString();
	}
	
	/**
	 * Returns the CSS value of the Color.
	 * @return the CSS value.
	 */
	@Override
	public String toString(){
		return color;
	}
	
	public int getRed() {
		return red;
	}

	public int getGreen() {
		return green;
	}

	public int getBlue() {
		return blue;
	}
}
